import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout/index'

Vue.use(VueRouter)

export const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: '/',
        name: 'dashboard',
        component: () => import('@/views/dashboard')
      },
      {
        path: '/agents',
        name: 'agents',
        component: () => import('@/views/agents')
      },
      {
        path: '/category',
        name: 'category',
        component: () => import('@/views/category')
      },
      {
        path: '/detail',
        name: 'detail',
        component: () => import('@/views/detail')
      },
      {
        path: '/page',
        name: 'page',
        redirect: '/page/group',
        component: () => import('@/views/page'),
        children: [
          {
            path: '/page/group',
            name: 'page',
            component: () => import('@/views/page/components/group'),
          },
          {
            path: '/page/company',
            name: 'company',
            component: () => import('@/views/page/components/company'),
          },
          {
            path: '/page/enterprise',
            name: 'enterprise',
            component: () => import('@/views/page/components/enterprise'),
          },
          {
            path: '/page/contact',
            name: 'contact',
            component: () => import('@/views/page/components/contact'),
          },
        ]
      },
      {
        path: '/property',
        name: 'property',
        component: () => import('@/views/property')
      },
      {
        path: '/agentslist',
        name: 'agentslist',
        component: () => import('@/views/agents/components/agent-list')
      },
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/404')
  }

]

const router = new VueRouter({
  routes
})

export default router
